﻿using System;
public enum DanmakuType
{
    neutral,
    helpful,
    harmful
}
public class Message
{

    public string content;
    public string nickname;
    public int t;//team
    public float pos;//Y position
    private static Random rd = new Random();
    public DanmakuType atti;//弹幕的态度
    public Message()
    {
    }
    public void AutoGenerate(string txt, bool isSingleMode = false)
    {
        if (txt.Trim() != string.Empty)
        {
            content = txt;
        }
        else
        {
            content = UnityEngine.Random.value > 0.5f ? "你真棒！你真帅！" : "毒瘤毒瘤毒瘤";

        }
        nickname = "吃瓜群众";
        t = rd.Next(2);
        float _t = (float)rd.NextDouble();
        if (isSingleMode)
        {
            pos = _t;
        }
        else
        {
            _t = _t * 0.9f;

            pos = _t * _t * _t;

        }
    }
    public float GetYOffset()
    {
        var _pos = (float)pos * 10 - 5;
        return _pos;
    }

    public float GetXOffset()
    {
        float x = 6;
        if (t == 0)
        {
            x *= -1;
        }
        return x;
    }
    public float dir()
    {
        return t == 0 ? 1 : -1;
    }
}
